package com.mql.ganio.ui;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.mql.ganio.R;
import com.mql.ganio.model.response.GanIoResponse;
import com.mql.ganio.ui.base.baseadapter.BaseRecyclerViewAdapter;
import com.mql.ganio.ui.base.baseadapter.BaseRecyclerViewHolder;
import com.mql.ganio.util.DensityUtil;

import java.util.List;

/**
 * 作者：Administrator on 2017/11/8 13:08
 */
public class GanHuoAdapter extends BaseRecyclerViewAdapter<GanIoResponse.ResultsBean,BaseRecyclerViewHolder> {
    private List<GanIoResponse.ResultsBean> list;
    public GanHuoAdapter(Context context, List mList) {
        super(context, mList);
        this.list=mList;
    }


    @Override
    public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = mLayoutInflater.inflate(R.layout.item_welfare, parent, false);

        return new BaseRecyclerViewHolder(context,view);
    }

    @Override
    public void onBindViewHolder(BaseRecyclerViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        if (position % 2 == 0) {
            DensityUtil.setViewMargin(holder.itemView, false, 12, 6, 12, 0);
        } else {
            DensityUtil.setViewMargin(holder.itemView, false, 6, 12, 12, 0);
        }
        holder.setImageView(R.id.iv_welfare,list.get(position).getUrl());
    }
}
